import { request } from "./request.js";

export function getUserList(params) {
  return request({
    method: "get",
    url: "users",
    params,
  });
}

export function upDateUserList(params) {
  return request({
    method: "put",
    url: `users/${params.id}/state/${params.mg_state}`,
  }).then((res) => {
    //  console.log("请求发送成功")
    return new Promise((resolve, reject) => {
      resolve(res);
    });
  });
}

export function addUser_axios(data) {
  return request({
    url: "users",
    method: "post",
    data,
  });
}

export function changeUserInfo(params) {
  return request({
    method: "get",
    url: "users/" + params,
  });
}

export function upDataChange(id,data) {
  return request({
    method: "put",
    url: "users/" + id,
    data,
  });
}


export function removeUser(id){
  return request({
    method: "delete",
    url: `users/${id}`,
  })
}


//分配角色请求
export function saveRoleInfo(id,roleId) { 
  return request({
    method: "put",
    url: `users/${id}/role`,
    data: roleId,
  })
}

